package com.hmyuan.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hmyuan.dao.SysDictionaryTypeMapper;
import com.hmyuan.domain.SysDictionaryType;
import com.hmyuan.service.SysDictionaryTypeService;

@Service("sysDictionaryTypeService")
public class SysDictionaryTypeServiceImpl implements SysDictionaryTypeService {

	@Resource
	SysDictionaryTypeMapper sysDictionaryTypeMapper;
	
	@Override
	public PageInfo<SysDictionaryType> selectListByPage(
			SysDictionaryType sysDictionaryType, int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, pageSize); // 核心分页代码
		List<SysDictionaryType> list = sysDictionaryTypeMapper.selectList(sysDictionaryType);
		PageInfo<SysDictionaryType> pageInfo = new PageInfo<SysDictionaryType>(list);
		return pageInfo;
	}

	@Override
	public boolean insert(SysDictionaryType sysDictionaryType) {
		// TODO Auto-generated method stub
		int num = sysDictionaryTypeMapper.insert(sysDictionaryType);
		return num==1?true:false;
	}

	@Override
	public List<SysDictionaryType> selectList(
			SysDictionaryType sysDictionaryType) {
		// TODO Auto-generated method stub
		return sysDictionaryTypeMapper.selectList(sysDictionaryType);
	}

	@Override
	public SysDictionaryType selectByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return sysDictionaryTypeMapper.selectByPrimaryKey(id);
	}

	@Override
	public boolean updateByPrimaryKeySelective(
			SysDictionaryType sysDictionaryType) {
		// TODO Auto-generated method stub
		int num = sysDictionaryTypeMapper.updateByPrimaryKeySelective(sysDictionaryType);
		return num==1?true:false;
	}

	@Override
	public boolean deleteByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		int num = sysDictionaryTypeMapper.deleteByPrimaryKey(id);
		return num==1?true:false;	
	}

}
